From: Patrick Ward Date: Wed, 1 Oct 2014 00:47:07 +0000 (-0700) Subject: search: Change order of duplicate search check X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2059 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=72b0a3d78f446779d61747e0930d43a9e31a63d0;p=gnome-shell.git search: Change order of duplicate search check Checks for a duplicate search before setting the current search to true and before cancelling the current search. This ensures that if a duplicate search occurs while the previous search is still active, the duplicate search will not incorrectly cancel or change the state of the previous search. --- diff --git a/js/ui/search.js b/js/ui/search.js index d2ecd91aa..2a8e0fd8e 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -498,6 +498,15 @@ const SearchResults = new Lang.Class({ }, setTerms: function(terms) { + // Check for the case of making a duplicate previous search before + // setting state of the current search or cancelling the search. + // This will prevent incorrect state being as a result of a duplicate + // search while the previous search is still active. + let searchString = terms.join(' '); + let previousSearchString = this._terms.join(' '); + if (searchString == previousSearchString) + return; + this._startingSearch = true; this._cancellable.cancel(); @@ -508,11 +517,6 @@ const SearchResults = new Lang.Class({ return; } - let searchString = terms.join(' '); - let previousSearchString = this._terms.join(' '); - if (searchString == previousSearchString) - return; - let isSubSearch = false; if (this._terms.length > 0) isSubSearch = searchString.indexOf(previousSearchString) == 0;